#define _CRT_SECURE_NO_WARNINGS 1
#include"RBTree.h"

using namespace std;

void test1()
{
	RBTree<int, int> rb;
	int ar[] = { 3,1,4,8,4,6,3,8,1,0,10,4,5,2,9 };
	for (auto e : ar)
	{
		rb.Insert({ e,e });
	}
	for (int i = 0; i < 100; i++)
	{
		rb.Insert({ i,i });
	}
	rb.InOrder();
}
void test2()
{
	RBTree<int, int> a;
	srand((unsigned int)time(0));
	int N = 1000000;
	size_t ret1 = clock();
	for (int i = 0; i < N; i++)
	{
		int num = rand() + i;
		a.Insert({ num,num });
	}
	
	size_t ret2 = clock();
	cout << "insert->time : " << ret2 - ret1 << endl;

	size_t ret3 = clock();
	for (int i = 0; i < N; i++)
	{
		int num = rand() + i;
		a.find(num);
	}
	size_t ret4 = clock();

	cout << "insert->time : " << ret2 - ret1 << endl;
	cout << "find->time : " << ret4 - ret3 << endl;
	cout << "size-> " << a.size() << endl;
	cout << "height-> " << a.height() << endl;
	cout << a.IsBalance() << endl;
}
int main()
{
	test2();
	return 0;
}